home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-01-31 | 3.3 KB | 95 lines | [TEXT/R*ch] |
- // ===========================================================================
- // File: UMenuedWindows.h
- // Version: 1.0 - May 7, 1996
- // Author: Mike Shields (mshields@inconnect.com)
- //
- // Copyright ©1996 Mike Shields. All rights reserved.
- // ===========================================================================
- // UMenuedWindows.cp <- double-click + Command-D to see class declaration
- //
- // A set of classes which allow you to manage the dynamic portion of a Windows
- // menu in your application. These include the static class whcih does all of the
- // real work, an LAttachment class which manages the selection and hiliting of the
- // menu items, and a LWindow subclass which knows how to add and delete itself from
- // the menu
-
- #pragma once
-
- #include <PP_Types.h>
- #include <LAttachment.h>
- #include <LWindow.h>
-
- class LArray;
-
- //===========================================================================
- // UMenuedWindows
- //===========================================================================
- // This static class is the interface to the Windows menu. It handles adding
- // and deleting menu items which correspond to a window in your application
-
- class UMenuedWindows
- {
- friend class CMenuedWindowsAttachment;
-
- public:
- static void InitMenuedWindows(Int16 inMENUid, LApplication* inApplication);
-
- static void AddWindowToMenu(LWindow* inWindow);
- static void RemoveWindowFromMenu(LWindow* inWindow);
-
- static Int16 WindowToMenuItem(LWindow* inWindow);
- static LWindow* MenuItemToWindow(Int16 inMenuItem);
- static void SetCommandKey(LWindow* inWindow, char inKey);
-
- private:
- static ResIDT sMenuID;
- static Int16 sSeparatorPosition;
- static LArray* sWindowList;
-
- static void GetMenuItemStatus(Int16 inMenuItem, Boolean &outEnabled,
- Boolean &outUsesMark, Char16 &outMark,
- StringPtr outName);
- static void SelectWindowMenuWindow(Int16 inMenuItem);
- };
-
- //===========================================================================
- // CMenuedWindowsAttachment
- //===========================================================================
- // This class implements an attachment which gets attached to the application
- // and will filter events intended for the Windows menu. It handles enabling
- // and selecting of those items in the Windows menu corresponding to the
- // windows which were dynamically added the the menu.
-
- class CMenuedWindowsAttachment : public LAttachment
- {
- public:
- CMenuedWindowsAttachment(ResIDT inMenuID, Int16 inFirstItem);
- virtual ~CMenuedWindowsAttachment();
-
- protected:
- virtual void ExecuteSelf(MessageT inMessage, void *ioParam);
-
- ResIDT mMenuID;
- Int16 mFirstItem;
- };
-
- //===========================================================================
- // CMenuedWindow
- //===========================================================================
- // This class implements a window which automatically adds itself to the
- // Windows menu.
-
- class CMenuedWindow : public LWindow
- {
- public:
- enum { class_ID = 'MnuD' };
- static CMenuedWindow*
- CreateFromStream(LStream *inStream);
- CMenuedWindow();
- CMenuedWindow(const SWindowInfo &inWindowInfo);
- CMenuedWindow(ResIDT inWINDid, Uint32 inAttributes,
- LCommander *inSuperCommander);
- CMenuedWindow(LStream *inStream);
- virtual ~CMenuedWindow();
- };
-